package com.baizhi.testgenerate;

import com.baizhi.CmfzApplication;
import com.baizhi.entity.User;
import com.baizhi.service.UserService;
import com.baizhi.util.GenerateUserUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.ArrayList;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = CmfzApplication.class)
public class GenernateData {

    @Autowired
    private UserService userService;

    @Test
    public void m() {
        List<User> users = new ArrayList<>();
        for (int i = 0; i < 100000; i++) {
            User user = GenerateUserUtil.getUser();
            users.add(user);
        }
        userService.addUserMultiple(users);
    }
}
